import { defineStore } from 'pinia'
import {reqIndex} from '../../api/home'
import type { focus,policyDesc,kingKong,indexActivity,category} from '../../api/home/mudul';

export const indexMsg = defineStore({
  id:"indexMsg",
  state: () => ({
    focusList:<focus[]>[],  //banner
    policyDescList:<policyDesc[]>[],  //banner下三剑客
    kingKongList:<kingKong[]>[],  //banner下导航图标
    indexActivityModule:<indexActivity[]>[],  // 新人专享右边两    
    categoryList:<category[]>[], // 类目热销榜列表
    
    
  }),

   
  actions: {
    async getIndex () {
      let res = await reqIndex()
      console.log(res);
      
      
      this.focusList = res.data.data.data.focusList
      this.policyDescList = res.data.data.data.policyDescList
      this.kingKongList = res.data.data.data.kingKongModule.kingKongList
      this.indexActivityModule = res.data.data.data.indexActivityModule
      this.categoryList = res.data.data.data.categoryHotSellModule.categoryList
     
      
    }

  }
  
})

